﻿Public Class KWindow : Inherits MoveableWindow

    Public Sub New(ByRef _mdg As MainDockGrid)
        MyBase.New(_mdg)
        ShowInTaskbar = False

      
    End Sub

    Public Sub New(ByVal _TITLE As String,
                   ByVal _FRMRSZBRDRTKNS As Thickness,
                   ByVal _GLSFRMTKNS As Thickness,
                   ByVal _CRNRRADIUS As CornerRadius,
                   ByVal _TTLBRHEIGHT As Double,
                   ByRef _mdg As MainDockGrid)
        MyBase.New(_TITLE, _FRMRSZBRDRTKNS, _GLSFRMTKNS, _CRNRRADIUS, _TTLBRHEIGHT, _mdg)
        ShowInTaskbar = false

    End Sub

    Public Sub New()
        MyBase.New()
        ShowInTaskbar = False


    End Sub


    ' Dim tempLastTopMost As Boolean = False
    Private Sub GripMouseDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
        If MDG Is Nothing Then Return

        If MDG.GetVeryBaseGrid Is MDG.MainGrid And MDG.MainGrid.Children.Count = 0 Then
            MDG.UnMaskDockHelperInterface(DockHelperGrid.VisibleGizmos.InnerC)
        Else
            MDG.UnMaskDockHelperInterface(255)  '225 - > tutti visibili.
        End If

        MainGrid.ActivateBanner()

    End Sub

    Private Sub GripMouseUp(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
        If MDG Is Nothing Then Return

        MDG.MaskDockHelperInterface(511) '511 = Siano visibili tutti i valori.

        ' MDG.WindowParent.Topmost = tempLastTopMost
        MainGrid.DeactivateBanner()

    End Sub




    Private Sub _Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.Closing

        RemoveHandler MainGrid.Grip.MouseDown, AddressOf GripMouseDown
        RemoveHandler MainGrid.Grip.MouseUp, AddressOf GripMouseUp


        MainGrid.Grip.PuppetWindow = Nothing
    End Sub



    Private Sub _Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        AddHandler MainGrid.Grip.MouseDown, AddressOf GripMouseDown
        AddHandler MainGrid.Grip.MouseUp, AddressOf GripMouseUp

    End Sub



End Class